#include "../utils/Vector.hpp"
#include "Finder/NavHelper.h"
#include "Finder/PathFinder.h"

#include <string>
#include <iostream>

void test_solo(std::string mapname, std::string  navfile, std::string  method, std::string params)
{
	auto mesh = NavHelper::GetNavMesh((char*)navfile.c_str());
	if (mesh == nullptr)
	{
		std::cerr << "NavHelper::GetNavMesh() fail " << navfile << std::endl;
		return;
	}
	auto finder = NavHelper::GetFinder(mesh);
	if (finder == nullptr)
	{
		std::cerr << "NavHelper::GetFinder() fail " << navfile << std::endl;
		return;
	}

	if (method == "find")
	{
		float srcPos[3] = { 0.1,0.1,0.1 };
		float dstPos[3] = { 0.1,0.1,0.1 };
		if (!finder->Find(srcPos[0], srcPos[1], srcPos[2], dstPos[0], dstPos[1], dstPos[2]))
		{
			std::cout << "find path failed\n";
		}
		int count;

		auto ppos = finder->GetPath(&count);
		for (int i = 0; i < count; i++)
		{
			auto x = ppos[i * 3];
			auto y = ppos[i * 3 + 1];
			auto z = ppos[i * 3 + 2];
			printf("(%.2f,%.2f) \n", x, z);
		}
	}
}
